package com.zz.springboot.controller;

import com.zz.springboot.service.ExcelDealService;
import com.zz.springboot.service.NumDictionaryService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 此类为对涉及表格相关处理的接口
 */
@RestController
public class ExcelDealController {

    @Autowired
    ExcelDealService excelDealService;

    @Autowired
    NumDictionaryService numDictionaryService;

    /**
     * 导出初始化表格
     */
    @RequiresRoles(value = {"member", "admin"},logical = Logical.OR)
    @RequestMapping("/exportInitialExcel/{type}")
    public void exportInitialExcel(@PathVariable("type")Integer type){
        excelDealService.exportExcel(type);
    }

    /**
     * 二次挑选
     */
    @RequiresRoles(value = {"member", "admin"},logical = Logical.OR)
    @RequestMapping("/secondSelect")
    public void secondSelect() {
        excelDealService.secondSelect();
    }

    /**
     * 通用导入EXCEL接口
     */
    @RequiresRoles(value = {"member", "admin"},logical = Logical.OR)
    @RequestMapping("/importCommonExcel/{type}")
    public void importCommonExcel(@PathVariable("type") Integer type){
        excelDealService.importCommonExcel(type);
    }

    /**
     * 通用插入号码字典表数据接口
     */

    @RequiresRoles("admin")
    @RequestMapping("/importNumDictExcel")
    public void importNumDictExcel() {

        excelDealService.importNumDictExcel();
    }
}
